namespace Core
{
    public class Tile
    {
        public string Character { get; private set; }
        public int Score { get; private set; }
        public Tile(string character, int score)
        {
            Character = character;
            Score = score;
        }

        public bool Equals(Tile obj)
        {
            if (ReferenceEquals(null, obj)) return false;
            if (ReferenceEquals(this, obj)) return true;
            return Equals(obj.Character, Character) && obj.Score == Score;
        }

        public override bool Equals(object obj)
        {
            if (ReferenceEquals(null, obj)) return false;
            if (ReferenceEquals(this, obj)) return true;
            if (obj.GetType() != typeof (Tile)) return false;
            return Equals((Tile) obj);
        }

        public override int GetHashCode()
        {
            unchecked
            {
                return (Character.GetHashCode()*397) ^ Score;
            }
        }

        public static bool operator ==(Tile left, Tile right)
        {
            return Equals(left, right);
        }

        public static bool operator !=(Tile left, Tile right)
        {
            return !Equals(left, right);
        }
    }
}